package cn.faifai.tagapi.startup;

import cn.faifai.tagapi.config.HardLinksConfig;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.io.File;

@Component
public class HardLinkCheck implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        File[] roots = File.listRoots();
        for (File root : roots) {
            String path = root.getPath() + "\\"+ HardLinksConfig.DIRECTORY +"\\";
            File file = new File(path);
            if (!file.exists()) {
                file.mkdir();
            }
        }
    }
}
